<?php


return [
    'servers' => [                                     //所有配置的server
        'http' => [                                    //命令启动的服务名
            'type' => \sws\Server::HTTP,               //服务类型
            'host' => '0.0.0.0',                       //监听地址
            'port' => 9001,                            //监听端口
            'mode' => SWOOLE_PROCESS,                  //运行模式 默认为SWOOLE_PROCESS
            'sock_type' => SWOOLE_SOCK_TCP,            //sock type 默认为SWOOLE_SOCK_TCP
            'setting' => [                             //当前server配置项，会覆盖公共设置
                'pid_file' => BASE_PATH . 'http.pid',  //每个服务独立的文件，切记不可重名
                'log_file' => BASE_PATH . 'http.log',
                'daemonize' => false,
            ],
            'event' => [
                'onRequest' => []
            ]
        ],
        'websocket' => [
            'type' => \sws\Server::WEB_SOCKET,
            'host' => '0.0.0.0',                       //监听地址
            'port' => 9002,                            //监听端口
            'mode' => SWOOLE_PROCESS,                  //运行模式 默认为SWOOLE_PROCESS
            'sock_type' => SWOOLE_SOCK_TCP,            //sock type 默认为SWOOLE_SOCK_TCP
            'setting' => [                             //当前server配置项，会覆盖公共设置
                'pid_file' => BASE_PATH . 'websocket.pid',  //每个服务独立的文件，切记不可重名
                'log_file' => BASE_PATH . 'websocket.log',
                'daemonize' => false,
            ],
        ]
    ],

    //公共设置项,所有server公共配置项
    'setting' => [
        'reactor_num' => swoole_cpu_num() * 2,           //reactor线程数
        'worker_num' => swoole_cpu_num(),                //worker进程数
        'max_request' => 0,                              //worker进程的最大任务数
        'task_worker_num' => 0,                          //Task 进程的数量。配置后Server务必要注册onTask、onFinish2个事件回调函数
        'dispatch_mode' => 2,                            //数据包分发策略
        'daemonize' => false,                            //守护进程化
        'log_file' => BASE_PATH . 'swoole_err.log'        //指定 Swoole 错误日志文件
        //.....
    ],
    //公共事件绑定
    'event' => [


    ]
];